/*
 * Copyright © 2021 http://www.TestCopyright.com/ All rights reserved.
 */
package com.xjh.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjh.bo.StudentBO;
import com.xjh.mapper.StudentMapper;
import com.xjh.po.StudentPO;
import com.xjh.service.StudentService;
import com.xjh.utils.annotation.LogTest;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： 徐建华
 * @date： 2021/11/28
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@Service("StudentService")
public class StudentServiceImpl extends ServiceImpl<StudentMapper, StudentPO> implements StudentService {
    // 继承serviceImpl（接口要同时继承）的原因是需要在service层进行增删改查操作，此时就不用引入mapper，
    // 在dao层中可以完成对数据库的增删改查，那为什么还要在Service层中还要完成对数据库的增删改查呢？答案：ServiceImpl封装了一些批量操作的方法
    private final StudentMapper studentMapper;

    public StudentServiceImpl(StudentMapper studentMapper) {
        this.studentMapper = studentMapper;
    }

    @LogTest(description = "操作学生查询分页")
    @Override
    public IPage<StudentBO> queryAll(Page<StudentBO> pageParam) {
        // 构造查询条件
        QueryWrapper<StudentPO> wrapper = new QueryWrapper<>();
        // 执行分页查询，返回Ipage<实体类类型>
        // IPage<StudentBO> res = studentMapper.selectPage(pageParam, wrapper);
        IPage<StudentBO> res = null;
        return res;
    }

    @Override
    public List<Map<String, Object>> queryScoreSort() {
        List<Map<String, Object>> res = studentMapper.queryScoreSort();
        return res;
    }

    @Override
    public List<Map<String, Object>> queryAccountAndStudent() {
        List<Map<String, Object>> res = studentMapper.queryAccountAndStudent();
        return res;
    }

    @Override
    public List<Map<String, Object>> allAccountOfStudent() {
        List<Map<String, Object>> res = studentMapper.allAccountOfStudent();
        return res;
    }
}
